package com.cz.modules.jk.controller;

import com.cz.common.utils.ParkingUtil;
import com.cz.common.utils.R;
import com.cz.modules.jk.service.ScreenPushService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("screen/push")
public class ScreenPushController {
    @Autowired
    private ScreenPushService screenPushService;
    @RequestMapping("/pushsmallS")
    public R pushsmallS(HttpServletRequest request){
        screenPushService.pushsmallS(request);
        return R.ok();
    }
    @RequestMapping("/pushsmallN")
    public R pushsmallN(HttpServletRequest request){
        screenPushService.pushsmallN(request);
        return R.ok();
    }
    @RequestMapping("/pushbigS")
    public R pushbigS(){
        List<String> list = screenPushService.pushbigS();
        return R.ok().put("list",list);
    }
    @RequestMapping("/pushbigN")
    public R pushbigN(){
        List<String> list = screenPushService.pushbigN();
        return R.ok().put("list",list);
    }
    @RequestMapping("/getParkCountS")
    public R getParkCountS(){
        List<String> list = screenPushService.getParkCountS();
        return R.ok().put("list",list);
    }
    @RequestMapping("/getParkCountN")
    public R getParkCountN(){
        List<String> list = screenPushService.getParkCountN();
        return R.ok().put("list",list);
    }
    @RequestMapping("/setScreenStatus")
    public R setScreenStatus(@RequestParam Map<String, Object> params){
        String type=(String)params.get("type");
        if("sm1".equals(type)){
            ParkingUtil.ssStatus = true;
        }else if("sm2".equals(type)){
            ParkingUtil.ssStatus = false;
        }else if("nm1".equals(type)){
            ParkingUtil.nsStatus = true;
        }else if("nm2".equals(type)){
            ParkingUtil.nsStatus = false;
        }else if("sb1".equals(type)){
            ParkingUtil.sbStatus = true;
        }else if("sb2".equals(type)){
            ParkingUtil.sbStatus = false;
        }else if("nb1".equals(type)){
            ParkingUtil.nbStatus = true;
        }else if("nb2".equals(type)){
            ParkingUtil.nbStatus = false;
        }
        return R.ok();
    }
}
